from ship_envs.core.obs_viewer import ObsViewer
from ship_envs.environment.single_ship_env_s1 import SingleShipEnvS1


def show():
    env = SingleShipEnvS1()
    for _ in range(10):
        env.reset()
        while True:
            obs, reward, done, info = env.step(env.action_space.sample())
            env.render()
            if done:
                break

def obs_img_test():
    env = SingleShipEnvS1()
    env.reset()
    for _ in range(40):
        env.step(0)
    viewer = ObsViewer(500, 500)
    viewer.add_model(env.get_ship().model)
    for ship in env.world.other_ships:
        viewer.add_model(ship.model)
    img = viewer.get_img()
    img.show()


if __name__ == '__main__':
    # show()
    obs_img_test()